<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="spring," />





  <link rel="alternate" href="/atom.xml" title="耿瑞阳的博客" type="application/atom+xml" />






<meta name="description" content="By default use of @EnableWebMvc or  automatically registers Bean Validation support in Spring MVC through the LocalValidatorFactoryBean when a Bean Validation provider such as Hibernate Validator is">
<meta name="keywords" content="spring">
<meta property="og:type" content="article">
<meta property="og:title" content="SpringMVC hibernate-validator校验请求参数">
<meta property="og:url" content="https://Gengry.github.io/2018/02/03/SpringMVC hibernate-validator校验请求参数/index.html">
<meta property="og:site_name" content="耿瑞阳的博客">
<meta property="og:description" content="By default use of @EnableWebMvc or  automatically registers Bean Validation support in Spring MVC through the LocalValidatorFactoryBean when a Bean Validation provider such as Hibernate Validator is">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2018-02-06T05:19:18.546Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="SpringMVC hibernate-validator校验请求参数">
<meta name="twitter:description" content="By default use of @EnableWebMvc or  automatically registers Bean Validation support in Spring MVC through the LocalValidatorFactoryBean when a Bean Validation provider such as Hibernate Validator is">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://Gengry.github.io/2018/02/03/SpringMVC hibernate-validator校验请求参数/"/>





  <title>SpringMVC hibernate-validator校验请求参数 | 耿瑞阳的博客</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">耿瑞阳的博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://Gengry.github.io/2018/02/03/SpringMVC hibernate-validator校验请求参数/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Geng">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="耿瑞阳的博客">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">SpringMVC hibernate-validator校验请求参数</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2018-02-03T15:04:51+08:00">
                2018-02-03
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/spring/" itemprop="url" rel="index">
                    <span itemprop="name">spring</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <blockquote>
<p>By default use of @EnableWebMvc or <mvc:annotation-driven> automatically registers Bean Validation support in Spring MVC through the LocalValidatorFactoryBean when a Bean Validation provider such as Hibernate Validator is detected on the classpath.</mvc:annotation-driven></p>
</blockquote>
<a id="more"></a>
<blockquote>
<p>注意 需要检验的bean需要被 context:component-scan 扫描到</p>
<p>如果不指定校验器，classpath内有hibernate validoter，spring会默认使用它。</p>
</blockquote>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@ApiOperation</span>(value=<span class="string">"提交商城订单"</span>,tags=<span class="string">"商城"</span>)</span><br><span class="line"><span class="meta">@Auth</span></span><br><span class="line"><span class="meta">@RequestMapping</span>(value = <span class="string">"/submitMallOrder"</span>,method=RequestMethod.POST)</span><br><span class="line"><span class="meta">@ResponseBody</span></span><br><span class="line"><span class="function"><span class="keyword">public</span> Object <span class="title">submitMallOrder</span><span class="params">(@RequestBody @Valid MallOrderInfosVO mallOrderInfoVO, BindingResult binding)</span> </span>&#123;</span><br><span class="line">	<span class="keyword">if</span>(binding.hasErrors())&#123;</span><br><span class="line">		<span class="keyword">return</span> ResultMessage.getValidFail(<span class="keyword">new</span> HashMap&lt;String,Object&gt;()).setBindingResult(binding);</span><br><span class="line">	&#125;</span><br><span class="line">	Map&lt;String,Object&gt; result = mallOrderInfoService.submitMallOrder(mallOrderInfoVO);</span><br><span class="line">	<span class="keyword">return</span> ResultMessage.newInstance().setCode(MapUtils.getInteger(result, <span class="string">"code"</span>)).setMessage(MapUtils.getString(result, <span class="string">"message"</span>)).setData(MapUtils.getObject(result, <span class="string">"data"</span>));</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.jsz.peini.bean.mall;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.math.BigDecimal;</span><br><span class="line"><span class="keyword">import</span> java.util.ArrayList;</span><br><span class="line"><span class="keyword">import</span> java.util.List;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.validation.Valid;</span><br><span class="line"><span class="keyword">import</span> javax.validation.constraints.DecimalMin;</span><br><span class="line"><span class="keyword">import</span> javax.validation.constraints.NotNull;</span><br><span class="line"><span class="keyword">import</span> javax.validation.constraints.Size;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.hibernate.validator.constraints.Range;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> io.swagger.annotations.ApiModelProperty;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">MallOrderInfosVO</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">	<span class="meta">@NotNull</span></span><br><span class="line">	<span class="meta">@Size</span>(min=<span class="number">1</span>)</span><br><span class="line">	<span class="meta">@Valid</span></span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"商城订单列表"</span>)</span><br><span class="line">	<span class="keyword">public</span> ArrayList&lt;MallSellerOrderInfoVo&gt; sellerOrderInfoVos;</span><br><span class="line">	</span><br><span class="line">	<span class="meta">@NotNull</span></span><br><span class="line">	<span class="meta">@DecimalMin</span>(<span class="string">"0.00"</span>)</span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"订单总额"</span>)</span><br><span class="line">	<span class="keyword">public</span> BigDecimal totalMoney;</span><br><span class="line">	</span><br><span class="line"><span class="comment">//	@NotNull</span></span><br><span class="line"><span class="comment">//	@Range(min=1,max=3)</span></span><br><span class="line"><span class="comment">//	@ApiModelProperty("支付方式 0金币；1微信；2支付宝")</span></span><br><span class="line"><span class="comment">//	public Integer payType;</span></span><br><span class="line"></span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"如果是通过购物车提交的订单，传过来购物车的id"</span>)</span><br><span class="line">	<span class="keyword">public</span> List&lt;Integer&gt; mallShopCartIds;</span><br><span class="line"></span><br><span class="line">	<span class="meta">@NotNull</span></span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"收货地址id"</span>)</span><br><span class="line">	<span class="keyword">public</span> Integer mallAddressId;</span><br><span class="line"></span><br><span class="line">	<span class="function"><span class="keyword">public</span> ArrayList&lt;MallSellerOrderInfoVo&gt; <span class="title">getSellerOrderInfoVos</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> sellerOrderInfoVos;</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setSellerOrderInfoVos</span><span class="params">(ArrayList&lt;MallSellerOrderInfoVo&gt; sellerOrderInfoVos)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.sellerOrderInfoVos = sellerOrderInfoVos;</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">	<span class="function"><span class="keyword">public</span> BigDecimal <span class="title">getTotalMoney</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> totalMoney;</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setTotalMoney</span><span class="params">(BigDecimal totalMoney)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.totalMoney = totalMoney;</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//	public Integer getPayType() &#123;</span></span><br><span class="line"><span class="comment">//		return payType;</span></span><br><span class="line"><span class="comment">//	&#125;</span></span><br><span class="line"><span class="comment">//</span></span><br><span class="line"><span class="comment">//	public void setPayType(Integer payType) &#123;</span></span><br><span class="line"><span class="comment">//		this.payType = payType;</span></span><br><span class="line"><span class="comment">//	&#125;</span></span><br><span class="line"></span><br><span class="line">	<span class="function"><span class="keyword">public</span> List&lt;Integer&gt; <span class="title">getMallShopCartIds</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> mallShopCartIds;</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setMallShopCartIds</span><span class="params">(List&lt;Integer&gt; mallShopCartIds)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.mallShopCartIds = mallShopCartIds;</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">	<span class="function"><span class="keyword">public</span> Integer <span class="title">getMallAddressId</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> mallAddressId;</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setMallAddressId</span><span class="params">(Integer mallAddressId)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.mallAddressId = mallAddressId;</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.jsz.peini.bean.mall;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.math.BigDecimal;</span><br><span class="line"><span class="keyword">import</span> java.util.ArrayList;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> javax.validation.Valid;</span><br><span class="line"><span class="keyword">import</span> javax.validation.constraints.DecimalMin;</span><br><span class="line"><span class="keyword">import</span> javax.validation.constraints.Min;</span><br><span class="line"><span class="keyword">import</span> javax.validation.constraints.NotNull;</span><br><span class="line"><span class="keyword">import</span> javax.validation.constraints.Size;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.hibernate.validator.constraints.Length;</span><br><span class="line"><span class="keyword">import</span> org.hibernate.validator.constraints.Range;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> io.swagger.annotations.ApiModelProperty;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">MallSellerOrderInfoVo</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">	<span class="meta">@NotNull</span></span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"店铺id"</span>)</span><br><span class="line">	<span class="keyword">private</span> Integer sellerId;</span><br><span class="line">	<span class="meta">@NotNull</span></span><br><span class="line">	<span class="meta">@DecimalMin</span>(<span class="string">"0.00"</span>)</span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"金额合计"</span>)</span><br><span class="line">	<span class="keyword">private</span> BigDecimal totalMoney;</span><br><span class="line">	<span class="meta">@NotNull</span></span><br><span class="line">	<span class="meta">@DecimalMin</span>(<span class="string">"0.00"</span>)</span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"商品总价"</span>)</span><br><span class="line">	<span class="keyword">private</span> BigDecimal goodsMoney;</span><br><span class="line">	<span class="meta">@NotNull</span></span><br><span class="line">	<span class="meta">@DecimalMin</span>(<span class="string">"0"</span>)</span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"支付金额"</span>)</span><br><span class="line">	<span class="keyword">private</span> BigDecimal payMoney;</span><br><span class="line">	<span class="meta">@NotNull</span></span><br><span class="line">	<span class="meta">@DecimalMin</span>(<span class="string">"0"</span>)</span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"快递费用"</span>)</span><br><span class="line">	<span class="keyword">private</span> BigDecimal expressPrice;</span><br><span class="line">	<span class="meta">@NotNull</span></span><br><span class="line">	<span class="meta">@DecimalMin</span>(<span class="string">"0"</span>)</span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"积分补贴"</span>)</span><br><span class="line">	<span class="keyword">private</span> BigDecimal scoreMoney;</span><br><span class="line">	<span class="meta">@NotNull</span></span><br><span class="line">	<span class="meta">@DecimalMin</span>(<span class="string">"0"</span>)</span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"积分消耗"</span>)</span><br><span class="line">	<span class="keyword">private</span> Integer scoreUse;</span><br><span class="line">	<span class="meta">@NotNull</span></span><br><span class="line">	<span class="meta">@Min</span>(<span class="number">1</span>)</span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"购买件数"</span>)</span><br><span class="line">	<span class="keyword">private</span> Integer buyNum;</span><br><span class="line">	</span><br><span class="line">	<span class="meta">@NotNull</span></span><br><span class="line">	<span class="meta">@Range</span>(min=<span class="number">0</span>,max=<span class="number">3</span>)</span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"发票类型 0:不要发票 1:个人 2:企业 "</span>)</span><br><span class="line">	<span class="keyword">private</span> Integer invoiceType;</span><br><span class="line">	<span class="meta">@Length</span>(max=<span class="number">200</span>)</span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"发票抬头"</span>)</span><br><span class="line">	<span class="keyword">private</span> String invoiceTitle;</span><br><span class="line">	<span class="meta">@Length</span>(max=<span class="number">200</span>)</span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"留言"</span>)</span><br><span class="line">	<span class="keyword">private</span> String leaveMsg;</span><br><span class="line">	</span><br><span class="line">	<span class="meta">@NotNull</span></span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"收货人"</span>)</span><br><span class="line">	<span class="keyword">private</span> String receiveUser;</span><br><span class="line">	</span><br><span class="line">	<span class="meta">@NotNull</span></span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"收货电话"</span>)</span><br><span class="line">	<span class="keyword">private</span> String receiveTel;</span><br><span class="line">	<span class="meta">@Length</span>(max=<span class="number">200</span>)</span><br><span class="line">	<span class="meta">@NotNull</span></span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"收货地址"</span>)</span><br><span class="line">	<span class="keyword">private</span> String receiveAddress;</span><br><span class="line">	</span><br><span class="line">	<span class="meta">@Size</span>(min=<span class="number">1</span>)</span><br><span class="line">	<span class="meta">@ApiModelProperty</span>(<span class="string">"商品订单列表"</span>)</span><br><span class="line">	<span class="meta">@Valid</span></span><br><span class="line">	<span class="keyword">private</span> ArrayList&lt;MallGoodsOrderInfoVO&gt; mallGoodsOrderInfoVOs;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> Integer <span class="title">getSellerId</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> sellerId;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setSellerId</span><span class="params">(Integer sellerId)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.sellerId = sellerId;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> BigDecimal <span class="title">getTotalMoney</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> totalMoney;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setTotalMoney</span><span class="params">(BigDecimal totalMoney)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.totalMoney = totalMoney;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> BigDecimal <span class="title">getPayMoney</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> payMoney;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setPayMoney</span><span class="params">(BigDecimal payMoney)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.payMoney = payMoney;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> BigDecimal <span class="title">getExpressPrice</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> expressPrice;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setExpressPrice</span><span class="params">(BigDecimal expressPrice)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.expressPrice = expressPrice;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> BigDecimal <span class="title">getScoreMoney</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> scoreMoney;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setScoreMoney</span><span class="params">(BigDecimal scoreMoney)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.scoreMoney = scoreMoney;</span><br><span class="line">	&#125;</span><br><span class="line">	</span><br><span class="line">	<span class="function"><span class="keyword">public</span> Integer <span class="title">getScoreUse</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> scoreUse;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setScoreUse</span><span class="params">(Integer scoreUse)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.scoreUse = scoreUse;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> Integer <span class="title">getBuyNum</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> buyNum;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setBuyNum</span><span class="params">(Integer buyNum)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.buyNum = buyNum;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> Integer <span class="title">getInvoiceType</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> invoiceType;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setInvoiceType</span><span class="params">(Integer invoiceType)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.invoiceType = invoiceType;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> String <span class="title">getInvoiceTitle</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> invoiceTitle;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setInvoiceTitle</span><span class="params">(String invoiceTitle)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.invoiceTitle = invoiceTitle;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> String <span class="title">getLeaveMsg</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> leaveMsg;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setLeaveMsg</span><span class="params">(String leaveMsg)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.leaveMsg = leaveMsg;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> String <span class="title">getReceiveUser</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> receiveUser;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setReceiveUser</span><span class="params">(String receiveUser)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.receiveUser = receiveUser;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> String <span class="title">getReceiveTel</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> receiveTel;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setReceiveTel</span><span class="params">(String receiveTel)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.receiveTel = receiveTel;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> String <span class="title">getReceiveAddress</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> receiveAddress;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setReceiveAddress</span><span class="params">(String receiveAddress)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.receiveAddress = receiveAddress;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> ArrayList&lt;MallGoodsOrderInfoVO&gt; <span class="title">getMallGoodsOrderInfoVOs</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> mallGoodsOrderInfoVOs;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setMallGoodsOrderInfoVOs</span><span class="params">(ArrayList&lt;MallGoodsOrderInfoVO&gt; mallGoodsOrderInfoVOs)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.mallGoodsOrderInfoVOs = mallGoodsOrderInfoVOs;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> BigDecimal <span class="title">getGoodsMoney</span><span class="params">()</span> </span>&#123;</span><br><span class="line">		<span class="keyword">return</span> goodsMoney;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setGoodsMoney</span><span class="params">(BigDecimal goodsMoney)</span> </span>&#123;</span><br><span class="line">		<span class="keyword">this</span>.goodsMoney = goodsMoney;</span><br><span class="line">	&#125;</span><br><span class="line">	</span><br><span class="line">	</span><br><span class="line">	</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>一个完整实例<br><a href="http://blog.csdn.net/vbirdbest/article/details/72620957" target="_blank" rel="noopener">http://blog.csdn.net/vbirdbest/article/details/72620957</a></p>
<blockquote class="blockquote-center">今天最好的表现，是明天最低的要求。</blockquote>
      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/spring/" rel="tag"># spring</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2018/02/02/Mysql主从架构读写分离/" rel="next" title="Mysql主从架构读写分离">
                <i class="fa fa-chevron-left"></i> Mysql主从架构读写分离
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2018/02/05/虚拟机安装Centos，安装mysql，配置主从（一）/" rel="prev" title="虚拟机安装Centos，安装mysql，配置主从（一）">
                虚拟机安装Centos，安装mysql，配置主从（一） <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      

      <section class="site-overview-wrap sidebar-panel sidebar-panel-active">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">Geng</p>
              <p class="site-description motion-element" itemprop="description">今天最好的表现，是明天最低的要求。</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">25</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">13</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">10</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          

          
          

          
          

          

        </div>
      </section>

      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Geng</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
